import { http } from "@/utils/http";

/**
 能源接口
 **/
//能源首页-超标报警
export const warnSeach = (data: object) => {
  return http.request("post", `/energy/api/v1/homePage/queryDepartmentOverrate`, {
    data
  });
};
//能源首页-用能效率
export const costSeach = (data: object) => {
  return http.request("post", `/energy/api/v1/homePage/queryEnergyEfficiency`, {
    data
  });
};
// 能源用量
export const queryRole = (data: object) => {
  return http.request("post", `/energy/api/v1/energy/consume`, {
    data
  });
};
// 能源首页-本月用电结构
export const elecSeach = (data: object) => {
  return http.request("post", `/energy/api/v1/homePage/queryMonthElectricStructure`, {
    data
  });
};
//能源首页-生产情况
export const produceSeach = (data: object) => {
  return http.request("post", `/energy/api/v1/homePage/queryProductionSituation`, {
    data
  });
};
//能源首页-部门用能排名
export const rankSeach = (data: object) => {
  return http.request("post", `/energy/api/v1/homePage/queryDepartmentConsumeRank`, {
    data
  });
};
//能源首页-总体用能一览
export const tceSeach = (data: object) => {
  return http.request("post", `/energy/api/v1/homePage/queryOverallConsume`, {
    data
  });
};
// 区域查询top10
export const rgnSeach = (data: object) => {
  return http.request("post", `/energy/api/v1/top/area`, {
    data
  });
};
// 使用量
export const used = (data: object) => {
  return http.request("post", `/energy/api/v1/top/device`, {
    data
  });
};
// 用能图标展示
export const egShow = (data: object) => {
  return http.request("post", `/energy/api/v1/energy/table`, {
    data
  });
};
// 楼宇展示能源数据
export const buildDataSearch = (data: object) => {
  return http.request("post", `/energy/api/v1/homePage/queryBuildingEnergyData`, {
    data
  });
};
// 部门用能KPI使用状况
export const usedSeach = (data: object) => {
  return http.request("post", `/energy/api/v1/homePage/queryDepartmentConsumeKpi`, {
    data
  });
};

/**
 * 能源监控
 */
// 设备用能排名
export const eqttablelList = (data: object) => {
  return http.request("post", `/energy/api/v1/monitor/queryEquipmentRanking`, {
    data
  });
};
// 设备用能排名-总
export const eqttablelListAll = (data: object) => {
  return http.request("post", `/energy/api/v1/monitor/queryEquipmentRankingTotal`, {
    data
  });
};
// 区域用能排名
export const areatablelList = (data: object) => {
  return http.request("post", `/energy/api/v1/monitor/queryAreaRanking`, {
    data
  });
};
// 设备用能列表
export const eqttablelData = (data: object) => {
  return http.request("post", `/energy/api/v1/monitor/queryEquipmentEnergyReport`, {
    data
  });
};
// 区域用能列表
export const areatablelData = (data: object) => {
  return http.request("post", `/energy/api/v1/monitor/queryAreaEnergyReport`, {
    data
  });
};
// 设备用能列表-水
export const eqtWatertablelData = (data: object) => {
  return http.request("post", `/energy/api/v1/monitor/water/queryEquipmentEnergyReport`, {
    data
  });
};
// 区域用能列表-水
export const areaWatertablelData = (data: object) => {
  return http.request("post", `/energy/api/v1/monitor/water/queryAreaEnergyReport`, {
    data
  });
};
// 总用水量
export const waterTotal = (data: object) => {
  return http.request("post", `/energy/api/v1/monitor/water/queryWaterTotal`, {
    data
  });
};
// 本月总排水量
export const waterTotalOut = (data: object) => {
  return http.request("post", `/energy/api/v1/monitor/water/queryWaterDrainage`, {
    data
  });
};
// 本月总水费用
export const waterTotalCost = (data: object) => {
  return http.request("post", `/energy/api/v1/monitor/water/queryWaterTotalCost`, {
    data
  });
};
// 本月总回收水量
export const waterTotalRecycled = (data: object) => {
  return http.request("post", `/energy/api/v1/monitor/water/queryWaterTotalRecycled`, {
    data
  });
};
// 总蒸汽耗量
export const steamConsumTotal = (data: object) => {
  return http.request("post", `/energy/api/v1/monitor/steam/querySteamConsumption`, {
    data
  });
};
// 总LNG耗量
export const lngConsumTotal = (data: object) => {
  return http.request("post", `/energy/api/v1/monitor/ng/queryNgConsumption`, {
    data
  });
};
// 设备能源排名总
export const equipmentRankingTotal = (data: object) => {
  return http.request("post", `/energy/api/v1/monitor/queryEquipmentRankingTotal`, {
    data
  });
};

/**
 *
 * 能流图
 *
 */

// 各楼数据
export const queryBuildData = (data: object) => {
  return http.request("post", `/energy/api/v1/flow/queryEnergyPathSimulation`, {
    data
  });
};

// 能源占比
export const energyProportion = (data: object) => {
  return http.request("post", `/energy/api/v1/flow/queryEnergyProportion`, {
    data
  });
};
// 能源负荷趋势
// export const energyLoadTrend = (data: object) => {
//   return http.request("post", `/energy/api/v1/flow/queryEnergyLoadTrend`, {
//     data
//   });
// };
// 能源负荷趋势
export const energyLoadTrend = (isWater, data: object) => {
  return http.request("post", isWater ? `/energy/api/v1/flow/water/queryEnergyLoadTrend` : `/energy/api/v1/flow/queryEnergyLoadTrend`, {
    data
  });
};
// 能流图
export const energyFlowChart = (data: object) => {
  return http.request("post", `/energy/api/v1/flow/queryEnergyFlowChart`, {
    data
  });
};
// 能流图-水
export const waterFlowChart = (data: object) => {
  return http.request("post", `/energy/api/v1/flow/water/queryWaterFlowChart`, {
    data
  });
};

/**
 * TAP_WATER("TW", "自来水", "自来水"),

    ULTRA_PURE_WATER("UPW", "UPW", "超纯水"),

    PROCESS_COOLING_WATER("PCW", "PCW", "工艺冷却水"),

    RECYCLED_WATER("RW", "RW", "回收水"),

    MUNICIPAL_RECLAIMED_WATER("MRW", "再生水", "再生水"),

    DEIONIZED_WATER("DI", "DI", "去离子水"),

    REVERSE_OSMOSIS_WATER("RO", "RO", "反渗透水"),

    WASTE_WATER("WW", "WW", "废水")
    
     ALL 总水
 */

/**
 *
 * 能效报表
 *
 */
// 能效报表-电
export const energyReport = (data: object) => {
  return http.request("post", `/energy/api/v1/report/queryElectricityReport`, {
    data
  });
};
// 能效报表-水，蒸汽，LNG
export const energyReportCommon = (data: object) => {
  return http.request("post", `/energy/api/v1/report/queryEnergyReport`, {
    data
  });
};
// 能效报表-历史曲线
export const energyReportHistory = (data: object) => {
  return http.request("post", `/energy/api/v1/report/queryEnergyReportHistory`, {
    data
  });
};

/**
 *
 * 能源消耗
 *
 */
// 总消耗 内外圈环形图
export const totalConsumption = (isWater: Boolean, data: object) => {
  return http.request("post", isWater ? `/energy/api/v1/consume/queryTotalConsumptionDoughnut` : `/energy/api/v1/consume/queryTotalConsumptionPie`, {
    data
  });
};
// 子系统曲线指标
export const subSystemCurveIndicator = (data: object) => {
  return http.request("post", `/energy/api/v1/consume/querySubSystemCurveIndicatorValue`, {
    data
  });
};
// 子系统指标
export const subSystemIndicator = (data: object) => {
  return http.request("post", `/energy/api/v1/consume/querySubSystemIndicator`, {
    data
  });
};
// SPC指标
export const spcIndicator = (data: object) => {
  return http.request("post", `/energy/api/v1/consume/querySpcIndicator`, {
    data
  });
};
// 根据字典配置查询消耗
export const consumeByDict = (data: object) => {
  return http.request("post", `/energy/api/v1/consume/queryConsumeByDict`, {
    data
  });
};
// 查询柱状图 通过面板字典/通过指标
export const barChart = (isWater: Boolean, data: object) => {
  return http.request("post", isWater ? `/energy/api/v1/consume/queryBarChart` : `/energy/api/v1/consume/queryBarChartByPanelKey`, {
    data
  });
};

// 查询占比图
export const pieChartAll = (data: object) => {
  return http.request("post", `/api/v1/consume/queryRatio`, {
    data
  });
};

// 查询列表
export const scrollTableAll = (data: object) => {
  return http.request("post", `/api/v1/consume/queryTable`, {
    data
  });
};

// 查询总消耗
export const energyDeskAll = (data: object) => {
  return http.request("post", `/api/v1/consume/querytotalConsumption`, {
    data
  });
};

// 查询趋势图
export const barLineAll = (data: object) => {
  return http.request("post", `/api/v1/consume/queryTrend`, {
    data
  });
};

// 能源数据 -- 蒸汽 查询
export const getSteamListAPI = (data: object) => {
  return http.request("post", `/energy/energyData/listStream`, {
    data
  });
};

// 能源数据 -- 蒸汽 保存
export const saveSteamAPI = (data: object) => {
  return http.request("post", `/energy/energyData/saveStream`, {
    data
  });
};

// 能源数据 -- 蒸汽 删除
export const deleteSteamAPI = (data: object) => {
  return http.request("post", `/energy/energyData/deleteStream`, {
    data
  });
};

// 能源数据 -- 蒸汽 上传
export const uploadSteamAPI = (data: object) => {
  return http.request(
    "post",
    `/energy/energyData/uploadStream`,
    {
      data
    },
    {
      headers: {
        noLoading: true,
        "content-type": "application/x-www-form-urlencoded"
      }
    }
  );
};

// 能源数据 -- 热水 查询
export const getHotWaterListAPI = (data: object) => {
  return http.request("post", `/energy/energyData/listHotwater`, {
    data
  });
};

// 能源数据 -- 热水 保存
export const saveHotWaterAPI = (data: object) => {
  return http.request("post", `/energy/energyData/saveHotwater`, {
    data
  });
};

// 能源数据 -- 热水 删除
export const deleteHotWaterAPI = (data: object) => {
  return http.request("post", `/energy/energyData/deleteHotwater`, {
    data
  });
};

// 能源数据 -- 热水 上传
export const uploadHotWaterAPI = (data: object) => {
  return http.request(
    "post",
    `/energy/energyData/uploadHotwater`,
    {
      data
    },
    {
      headers: {
        noLoading: true,
        "content-type": "application/x-www-form-urlencoded"
      }
    }
  );
};

// 能源数据 -- 天然气 查询
export const getNaturalGasListAPI = (data: object) => {
  return http.request("post", `/energy/energyData/listNg`, {
    data
  });
};

// 能源数据 -- 天然气 保存
export const saveNaturalGasAPI = (data: object) => {
  return http.request("post", `/energy/energyData/saveNg`, {
    data
  });
};

// 能源数据 -- 天然气 删除
export const deleteNaturalGasAPI = (data: object) => {
  return http.request("post", `/energy/energyData/deleteNg`, {
    data
  });
};

// 能源数据 -- 天然气 上传
export const uploadNaturalGasAPI = (data: object) => {
  return http.request(
    "post",
    `/energy/energyData/uploadNg`,
    {
      data
    },
    {
      headers: {
        noLoading: true,
        "content-type": "application/x-www-form-urlencoded"
      }
    }
  );
};

// 能源数据 -- 大宗气 查询
export const getBulkGasListAPI = (data: object) => {
  return http.request("post", `/energy/energyData/listGas`, {
    data
  });
};

// 能源数据 -- 大宗气 保存
export const saveBulkGasAPI = (data: object) => {
  return http.request("post", `/energy/energyData/saveGas`, {
    data
  });
};

// 能源数据 -- 大宗气 删除
export const deleteBulkGasAPI = (data: object) => {
  return http.request("post", `/energy/energyData/deleteGas`, {
    data
  });
};

// 能源数据 -- 大宗气 上传
export const uploadBulkGasAPI = (data: object) => {
  return http.request(
    "post",
    `/energy/energyData/uploadGas`,
    {
      data
    },
    {
      headers: {
        noLoading: true,
        "content-type": "application/x-www-form-urlencoded"
      }
    }
  );
};

// 能源监控 -- 监控配置 查询
export const getMonitorConfigListAPI = (data: object) => {
  return http.request("post", `/energy/energySpc/listSpc`, {
    data
  });
};

// 能源监控 -- 监控配置 保存
export const saveMonitorConfigAPI = (data: object) => {
  return http.request("post", `/energy/energySpc/saveSpc`, {
    data
  });
};

// 能源监控 -- 监控配置 删除
export const deleteMonitorConfigAPI = (data: object) => {
  return http.request("post", `/energy/energySpc/deleteSpc`, {
    data
  });
};

// 能源监控 -- 监控配置 上传
export const uploadMonitorConfigAPI = (data: object) => {
  return http.request(
    "post",
    `/energy/energySpc/uploadSpc`,
    {
      data
    },
    {
      headers: {
        noLoading: true,
        "content-type": "application/x-www-form-urlencoded"
      }
    }
  );
};

// 能源监控 -- 监控配置--- 监控对象的下拉数据源
export const getSpcIndicatorAPI = (data: object) => {
  return http.request("post", `/energy/energySpc/spcIndicator`, {
    data
  });
};
